<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>OA管理系统</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-store, must-revalidate">
    <meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT">
    <meta http-equiv="expires" content="-1">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <link rel="shortcut icon" href="/dist/img/icon.png" type="image/x-icon" id="link">
    <!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" href="/dist/plugins/bootstrap/css/bootstrap.min.css">
    <!--&lt;!&ndash; Font Awesome &ndash;&gt;-->
    <link rel="stylesheet" href="/dist/css/font-awesome.min.css">
    <!--&lt;!&ndash; Ionicons &ndash;&gt;-->
    <link rel="stylesheet" href="/dist/css/ionicons.min.css">
    <!--OA主样式-->
    <link rel="stylesheet" href="/dist/css/OA.min.css?t=e9c5bb62">
    <link rel="stylesheet" href="/dist/css/skins/OA-skins.min.css?t=66b457d6">
    <style type="text/css">
        html {
            overflow: hidden;
        }

        .appDown {
            color: rgba(255, 255, 255, 0.8);;
            cursor: pointer;
            position: relative;
            padding: 0 10px;
        }

        .appDown img {
            position: absolute;
            left: 0px;
            top: 50px;
            border: 2px solid #ddd;
            display: none;
        }

        .appDown:hover img {
            display: block;
        }

        .xiaoxi .ui_title {
            padding-left: 10px;
            text-align: left;
        }

        .xiaoxi .ui_content {
            padding: 0px 10px !important;
            height: 100%;
            width: 100%;
            line-height: 1.7;
            background: #eee;
        }

        .xiaoxiLine {
            text-align: left;
            cursor: pointer;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 1;
        }

        .xiaoxiLine span {

        }

        .xiaoxiLine:hover {
            font-weight: bold;
            text-decoration: underline
        }

        #goOldOa {
            display: none;
        }

        .loginDh {
            width: 400px;
            height: 135px;
            position: absolute;
            z-index: 11111;
            text-align: center;
            background: rgba(255, 255, 255, 0.8);
            display: none;
        }

        .loginDh img {
            margin-top: 50px;
        }

        .ui_content {
            display: block;
        }
        .topUpdate{
            position: absolute;
            left: 50%;
            width: 322px;
            font-weight: bold;
            text-align: center;
            margin: 0;
            margin-left: -200px;
            background: #7d8694;
            color: #fff;
            font-size: 14px;
            line-height: 45px;
            border-radius: 5px;
            box-shadow: 0 1px 20px 0 rgba(112, 98, 89, 0.2);
            display: none;
        }
    </style>
    <!--[if lt IE 9]>
        <script src="/plugins/ie9/html5shiv.min.js"></script>
        <script src="/plugins/ie9/respond.min.js"></script>
    [endif]-->
</head>
<body class="hold-transition skin-blue sidebar-mini fixed">
<audio id="chatAudio">
    <source src="/dist/video/notify11.mp3" type="audio/mpeg">
    <source src="/dist/video/notify.wav" type="audio/wav">
    <source src="/dist/video/notify.ogg" type="audio/ogg">
</audio>
<div class="wrapper">
    <div class="oaLoad">
        <div class="loadGif" id="areaProgress" style="margin-left: -70px"></div>
    </div>
    <header class="main-header">
        <!-- Logo -->
        <a class="logo">
            <!-- mini logo for sidebar mini 50x50 pixels -->
            <span class="logo-lg"><i class="fa fa-angle-double-left" data-toggle="offcanvas" role="button"
                                     style="color: #fff;font-size: 18px;margin-left: 104px;margin-top: 28px;"></i></span>
            <span class="logo-mini"><i class="fa fa-angle-double-right" data-toggle="offcanvas" role="button"
                                       style="color: #fff;font-size: 18px;"></i></span>
            <!-- logo for regular state and mobile devices -->
            <!--<span class="logo-lg text-left"><img src="../dist/img/logoTwo.png" alt=""><b>工作OA</b></span>-->
        </a>
        <!-- Header Navbar: style can be found in header.less -->
        <nav class="navbar navbar-static-top">
            <!-- Sidebar toggle button-->
            <a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </a>
            <div class="content-tabs">
                <div id="updateClock" class="topUpdate" ></div>
                <!--<button class="roll-nav roll-left tabLeft" onclick="scrollTabLeft()">-->
                <!--<i class="fa fa-backward"></i>-->
                <!--</button>-->
                <nav class="page-tabs menuTabs tab-ui-menu" id="tab-menu ">
                    <div class="page-tabs-content" style="margin-left: 0px;">

                    </div>
                </nav>
                <!--<button class="roll-nav roll-right tabRight" onclick="scrollTabRight()">-->
                <!--<i class="fa fa-forward" style="margin-left: 3px;"></i>-->
                <!--</button>-->
                <!--<div class="btn-group roll-nav roll-right">-->
                <!--<button class="dropdown tabClose" data-toggle="dropdown">-->
                <!--页签操作<i class="fa fa-caret-down" style="padding-left: 3px;"></i>-->
                <!--</button>-->
                <!--<ul class="dropdown-menu dropdown-menu-right" style="min-width: 128px;">-->
                <!--<li><a class="tabReload" href="javascript:refreshTab();">刷新当前</a></li>-->
                <!--<li><a class="tabCloseCurrent" href="javascript:closeCurrentTab();">关闭当前</a></li>-->
                <!--<li><a class="tabCloseAll" href="javascript:closeOtherTabs(true);">全部关闭</a></li>-->
                <!--<li><a class="tabCloseOther" href="javascript:closeOtherTabs();">除此之外全部关闭</a></li>-->
                <!--</ul>-->
                <!--</div>-->
                <div class="south" style="position: absolute;top: 0px;right: 435px;">
                    <input type="button" value="强制更新信息" class="btn oaBtn btn-sm" onclick="submitMsg()" style="display:none;border: none;background: #228bee;color: #fff !important;" id="btnUpdate"/>
                </div>
                <ul class="nav navbar-nav" style="position: absolute;right: 40px;top:0px; background-color: #228bee;">
                    <li id="goOldOa"><a style="cursor: pointer;" href="http://60.205.143.20" target="_blank"><i
                            class="fa  fa-share"></i>&nbsp;&nbsp;跳转到旧OA</a></li>
                    <li class="appDown"><a><i class="fa  fa-mobile"></i>&nbsp;APP下载 <img alt="扫码下载" id="xzImg"
                                                                                         src="/dist/img/appDown.png"></a>
                    </li>
                    <!-- User Account: style can be found in dropdown.less -->
                    <li class="dropdown user user-menu">
                        <a class="dropdown-toggle" data-toggle="dropdown">
                            <i class="fa  fa-user"></i>&nbsp;
                            <span class="loginName"> </span><span class="minNo">、欢迎登录！</span>
                        </a>
                    </li>
                    <!-- Control Sidebar Toggle Button -->
                    <li>
                        <a id="aExit" data-toggle="control-sidebar" style="cursor: pointer;"><i
                                class="fa  fa-power-off"></i>&nbsp;&nbsp;退出</a>
                    </li>
                </ul>
                <button id="maxBtn" class="roll-nav roll-right fullscreen" onclick="App.handleFullScreen()"><i
                        class="fa fa-arrows-alt"></i></button>

            </div>

        </nav>

    </header>
    <!-- Left side column. contains the logo and sidebar -->
    <aside class="main-sidebar">
        <!-- sidebar: style can be found in sidebar.less -->
        <section class="sidebar">
            <!--<div class="toggle">-->
            <!--<div class="max">-->
            <!--<div class="text" style="margin-right: 50px;"> 功能导航</div>-->
            <!--<i class="fa fa-angle-double-left" data-toggle="offcanvas" role="button" style="color: #228bee;font-size: 18px;"></i>-->
            <!--</div>-->
            <!--<div class="min">-->
            <!--<i class="fa fa-angle-double-right" data-toggle="offcanvas" role="button" style="color: #228bee;font-size: 18px;margin-left: 20px;"></i>-->

            <!--</div>-->
            <!--&lt;!&ndash; Sidebar toggle button&ndash;&gt;-->

            <!--</div>-->
            <!-- /.search form -->
            <!-- sidebar menu: : style can be found in sidebar.less -->
            <ul class="sidebar-menu">

            </ul>
        </section>
        <!-- /.sidebar -->
    </aside>

    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper" id="content-wrapper" style="min-height: 421px;">
        <!--bootstrap tab风格 多标签页-->

        <div class="content-iframe " style="background-color: #ffffff; ">
            <div class="tab-content " id="tab-content">

            </div>
        </div>
    </div>
    <!-- /.content-wrapper -->

    <!--<footer class="main-footer">-->
    <!--<div class="pull-right hidden-xs">-->
    <!--<b>Version</b> 2.3.8-->
    <!--</div>-->
    <!--<strong>Copyright &copy; 2014-2016 <a href="http://almsaeedstudio.com">Almsaeed Studio</a>.</strong> All rights-->
    <!--reserved.-->
    <!--</footer>-->

    <!-- Control Sidebar -->

    <!-- /.control-sidebar -->
    <!-- Add the sidebar's background. This div must be placed
         immediately after the control sidebar -->
    <div class="control-sidebar-bg"></div>
</div>
<!-- ./wrapper -->
<!--JQ-->
<script src="https://file.ggxqce.com/web/jquery-2.2.3.min.js"></script><script>window.jQuery || document.write('<script src="/dist/plugins/jQuery/jquery-2.2.3.min.js"><\/script>','<script src="/dist/plugins/bootstrap/js/bootstrap.min.js"><\/script>','<script src="/dist/plugins/vue/vue.min.js"><\/script>')</script>
<script src="https://file.ggxqce.com/web/bootstrap.min.js"></script>
<!--框架已定义 JS-->
<script src="/dist/js/app_iframe.js?t=7e54a132"></script>
<!--oa自定义  JS-->
<script src="/dist/plugins/jQuery/jquery.cookie.min.js"></script>
<script src="/dist/js/oa.js?t=63aed32f"></script>
<script type="text/javascript" src="/dist/plugins/lhgdialog/lhgdialog.min.js?self=true"></script>
<script type="text/javascript">
    /**
     * 本地搜索菜单
     */
//    $(".loginName").click(function () {
//        console.log(getCurrentUser())
//        $.dialog({
//            content: 'url:entry.html?id=' + getCurrentUser().id + '&pageType=look',
//            title: getCurrentUser().userName+"详情",
//            width: 904,
//            height: 613,
//            max: true,
//            min: true,
//            lock: true
//        }).max();
//    });
    function search_menu() {
        //要搜索的值
        var text = $('input[name=q]').val();

        var $ul = $('.sidebar-menu');
        $ul.find("a.nav-link").each(function () {
            var $a = $(this).css("border", "");

            //判断是否含有要搜索的字符串
            if ($a.children("span.menu-text").text().indexOf(text) >= 0) {

                //如果a标签的父级是隐藏的就展开
                $ul = $a.parents("ul");

                if ($ul.is(":hidden")) {
                    $a.parents("ul").prev().click();
                }

                //点击该菜单
                $a.click().css("border", "1px solid");

//                return false;
            }
        });
    }
    $(function () {
        //如果当前登录人是李淑娴，显示发送消息按钮
        if(getCurrentUser().id=="2018031410514BCBB0A85F53979BECFD"){
            $("#btnUpdate").show();
        }
        if (server.fwq) {
            if (server.fwq == "wyp") {
                console.warn("当前登录的是沃源辽鞍系统")
                document.title = '沃源'

                var linkEle = document.getElementById("link");

                linkEle.href = '/dist/img/ewm-wy.png';

                linkEle.type = '';

                linkEle.type = 'image/x-icon';

                $("#xzImg").attr("src", "/dist/img/appDownWY.png")
                $("#goOldOa").show();
            }
        } else {
            console.warn("当前登录的是滚滚向前系统")
            if (getCurrentUser()) {
                document.title = '滚滚向前'
                if (getCurrentUser().companyId == "201804031651473CA771C95F5B8A0ACF" || getCurrentUser().companyId == "2018041104174574AC1D4939178B2D27") {
                    alert("您是沃源或辽鞍的用户，正在为您跳转到新OA地址：http://oa.woyuance.cn/page/new.html")
                    location.href = "http://oa.woyuance.com/page/new.html";
                }
            }
        }
        $("#aExit").click(function () {
            setCurrentUser(null);
            $.cookie("loginTel", null);
            $.cookie("loginPwd", null);
            window.location = "/page/login.html?t=" + new Date();
        })

        $(".loginName").text(getCurrentUser().name + "-" + getCurrentUser().roleName);
//        console.log(window.location);

        App.setbasePath("../");
        App.setGlobalImgPath("dist/img/");

        addTabs({
            id: '10008',
            title: '个人主页',
            close: false,
            url: '/welcome_iframe.html',
            urlType: "relative"
        });

        App.fixIframeCotent();

        function menuFormat(data) {
            var i, l,
                key = "id",
                parentKey = "parentId",
                childKey = "children";
            if (!key || key == "" || !data) return [];

            var r = [];
            var tmpMap = [];
            for (i = 0, l = data.length; i < l; i++) {
                tmpMap[data[i][key]] = data[i];
            }
            for (i = 0, l = data.length; i < l; i++) {
                if (tmpMap[data[i][parentKey]] && data[i][key] != data[i][parentKey]) {
                    if (!tmpMap[data[i][parentKey]][childKey])
                        tmpMap[data[i][parentKey]][childKey] = [];
                    tmpMap[data[i][parentKey]][childKey].push(data[i]);
                } else {
                    r.push(data[i]);
                }
            }
            return r;
        }

        var menus = "";
        $.ajax({
            url: server.ip + '/right/getMenuByUserId.json',
            data: JSON.stringify({
                userId: getCurrentUser().id,
                rightType: 1,
                companyBloom: getCurrentUser().companyBloom
            }),
        type: 'POST',
        dataType: 'json',
        contentType: 'application/json;charset=utf-8',
        success: function (r) {
        menus = menuFormat(r.data.sendData);
        $('.sidebar-menu').sidebarMenu({data: menus});
    }
    });

        var menus = [
            {
                id: "9000",
                text: "header",
                icon: "",
                isHeader: true
            },
            {
                id: "9001",
                text: "UI Elements",
                icon: "fa fa-laptop",
                children: [
                    {
                        id: "90011",
                        text: "buttons",
                        icon: "fa fa-circle-o",
                        url: "UI/buttons_iframe.html",
                        targetType: "iframe-tab"
                    },
                    {
                        id: "90012",
                        text: "icons",
                        url: "UI/icons_iframe.html",
                        targetType: "iframe-tab",
                        icon: "fa fa-circle-o"
                    },
                    {
                        id: "90013",
                        text: "general",
                        url: "UI/general_iframe.html",
                        targetType: "iframe-tab",
                        icon: "fa fa-circle-o"
                    },
                    {
                        id: "90014",
                        text: "modals",
                        url: "UI/modals_iframe.html",
                        targetType: "iframe-tab",
                        icon: "fa fa-circle-o"
                    },
                    {
                        id: "90015",
                        text: "sliders",
                        url: "UI/sliders_iframe.html",
                        targetType: "iframe-tab",
                        icon: "fa fa-circle-o"
                    },
                    {
                        id: "90016",
                        text: "timeline",
                        url: "UI/timeline_iframe.html",
                        targetType: "iframe-tab",
                        icon: "fa fa-circle-o"
                    }
                ]
            },
            {
                id: "9002",
                text: "Forms",
                icon: "fa fa-edit",
                children: [
                    {
                        id: "90021",
                        text: "advanced",
                        url: "forms/advanced_iframe.html",
                        targetType: "iframe-tab",
                        icon: "fa fa-circle-o"
                    },
                    {
                        id: "90022",
                        text: "general",
                        url: "forms/general_iframe.html",
                        targetType: "iframe-tab",
                        icon: "fa fa-circle-o"
                    },
                    {
                        id: "90023",
                        text: "editors",
                        url: "forms/editors_iframe.html",
                        targetType: "iframe-tab",
                        icon: "fa fa-circle-o"
                    }
                ]
            }
        ];

    });
    setTimeout(function () {
        App.handleFullScreen()
    }, 1000);

    //    App.handleFullScreen()
</script>
<!--消息-------------------------------------------------------------提醒-->
<script>
    /* 扩展窗口外部方法 */
    $.dialog.notice = function (options) {
        var opts = options || {},
            api, aConfig, hide, wrap, top,
            duration = opts.duration || 800;

        var config = {
            id: 'Notice',
            left: '100%',
            top: '100%',
            fixed: true,
            drag: false,
            resize: false,
            init: function (here) {
                api = this;
                aConfig = api.config;
                wrap = api.DOM.wrap;
                top = parseInt(wrap[0].style.top);
                hide = top + wrap[0].offsetHeight;
                wrap.addClass('xiaoxi')
                wrap.css('top', hide + 'px')
                    .animate({top: top + 'px'}, duration, function () {
                        opts.init && opts.init.call(api, here);
                    });
            },
            close: function (here) {
                wrap.animate({top: hide + 'px'}, duration, function () {
//                    opts.close && opts.close.call(this, here);
                    aConfig.close = $.noop;
                    api.close();
                });

                return false;
            }
        };

        for (var i in opts) {
            if (config[i] === undefined) config[i] = opts[i];
        }

        return $.dialog(config);
    };

    function excludeSpecial(str) {
        str = str.replace(/[\'\"\\\/\b\f\n\r\t]/g, '');
        str = str.replace(/[\@\#\$\%\^\&\*\{\}\:\"\L\<\>\?]/);
        return str;
    }

    function initS(str) {
        str = str.replace('【待审核】', '<span style=color:red;>【待审核】</span>');
        return str;
    }

    var oldMsgCt = {};
    function submitMsg(){
        var save = confirm('确实要发送强制更新消息吗?');
        if(save){
            $.wyui.postMethod("/updateInfo/sendUpdateMassage.json",{}, function (data) {
                alert("发送成功");
            });
        }
    }
    function getMsg() {
        $.wyui.postMethod(urlConfig.system.message.getMsgByUserId, {
            receiverUserId: getCurrentUser().id
        }, function (r) {
            if (r.length > 0 && oldMsgCt != r[0].createTime) {
                oldMsgCt = r[0].createTime;
                var p = new Array();
                p.push("<div id='msgModel'>")
                for (var i = 0; i < r.length; i++) {
                    var data = r[i];
                    p.push("<div class='xiaoxiLine' attr-id=" + data.receiverId + "><span onclick=openNewPage('" + excludeSpecial(data.openTitle) + "','" + data.openUrl.replace("/page/", "") + "','" + data.receiverId + "','" + i + "') style='cursor: pointer;'>" + initS(data.openTitle) + "</span></div>");
                }
                p.push("</div>")
                $.dialog.notice({
                    title: '| 最新消息',
                    width: '310px', /*必须指定一个像素宽度值或者百分比，否则浏览器窗口改变可能导致lhgDialog收缩*/
                    height: "102px",
                    content: p.join(""),
                    time: 300,
                    close: true,
                    min: false,
                    max: false
                });
                //$('#chatAudio')[0].play(); //播放声音
            }
        });
    };
    getMsg();
    getRedHot();
    /*更新信息弹窗*/
    var updateFlag = false;
    function updateDialog(data) {
        if(!updateFlag){
            updateFlag = true;
            top.$.alert({
                win: this,
                height: 180,
                width: 300,
                icon: '', //1成功 2失败 3提示 不穿代表无图标
                title: '检测到系统有新版本，是否刷新浏览器？',
                blankclose: false,//点击空白是否可关闭
                ok: "是",//是否显示确认按钮,
                okCallback: function (em, opts) {
                    $.wyui.postMethod("/updateInfo/save.json", {
                        userId:getCurrentUser().id
                    },function (r) {
                        window.location.href = '/page/index.html'
                    })
                    updateFlag = false;
                    //确认按钮回调
                    em.remove()
                    opts.close && opts.close()
                },
                cancel: "否",
                cancelCallback: function (em, opts) {
                    setTimeout(function () {
                        updateDialog();
                    },1000*60*10)
                    updateFlag = false;
                    em.remove()
                    opts.close && opts.close()
                }
            })
        }
    }
    /*顶端显示倒计时信息*/
    function updateClock(id, endDateStr,info) {
        $(id).show();
        if(info == "更新中"){
            $(".oaLoad").show();
        }
        clearInterval(updateClockPid);
        updateClockPid = setInterval(function () {
            //结束时间
            var endDate = new Date(endDateStr);
            //当前时间
            var nowDate = new Date();
            //相差的总秒数
            var totalSeconds = parseInt((endDate - nowDate) / 1000);
            if(totalSeconds<=0){
                /*到时间结束*/
                $(id).html("")
                $(id).hide();
                $(".oaLoad").hide();
                clearInterval(updateClockPid);
            }
            //取模（余数）
            var modulo = totalSeconds % (60 * 60 * 24) % (60 * 60);
            //分钟
            var minutes = Math.floor(modulo / 60);
            if(minutes<10){
                minutes = "0" + minutes;
            }
            //秒
            var seconds = modulo % 60;
            if(seconds<10){
                seconds = "0" + seconds;
            }
            $(id).html(info + ":" + minutes + ":" + seconds)
        }, 1000)
    }
    /*获取更新消息*/
//    (function(){
//        $.wyui.postMethod("/message/getUpdateMassage.json", {},function (r) {
//            var dadeadlineTime = new Date(r.deadline + "");
//            var nowDate = new Date();
//            if(dadeadlineTime > nowDate){
//                updateDialog(r);
//            }
//        })
//    })();

    /*获取红点消息*/
    function getRedHot(){
        $.wyui.postMethod("/message/getRedDotByUserId.json", {
            userId:getCurrentUser().id
        },function (r) {
            console.log(r)
            var redHot = r;
            var info = {};
            var exam = {};
            var contract = {};
            var waitPayList = {};
            //用款申请
            if(redHot.yksq){
                $('[pageid="20171206093442F4A4B3AEC7FEEDB02D"]').find(".hongDian").remove();
                $('[pageid="20171206093442F4A4B3AEC7FEEDB02D"]').append('<i class="hongDian" style="position: absolute;width: 8px;height: 8px;background: red;border-radius: 50%;right: 35px;"></i>')
            }else{
                $('[pageid="20171206093442F4A4B3AEC7FEEDB02D"]').find(".hongDian").remove();
            }
            //临时事项
            if(redHot.lssx){
                $('[pageid="2018012916394CDBA7CCAE5D2225DCC0"]').find(".hongDian").remove();
                $('[pageid="2018012916394CDBA7CCAE5D2225DCC0"]').append('<i class="hongDian" style="position: absolute;width: 8px;height: 8px;background: red;border-radius: 50%;right: 35px;"></i>')
            }else{
                $('[pageid="2018012916394CDBA7CCAE5D2225DCC0"]').find(".hongDian").remove();
            }
            var $iframe = top.findIframeByName("个人主页");
            setTimeout(function () {
                //合同
                $iframe[0].contentWindow.app.contract.count = redHot.ht;
                //付款审核
                $iframe[0].contentWindow.app.waitPayList.count = redHot.fksq;
                //培训管理
                $iframe[0].contentWindow.app.exam.count = redHot.px;
                //事项管理
                $iframe[0].contentWindow.app.info.unfinishCount = redHot.wwcsx;
                //项目管理
                $iframe[0].contentWindow.app.info.proCount = redHot.xmgz;
            },1000)

        })
    };

    /*
    setInterval(function () {  //使用  setTimeout（）方法设定定时2000毫秒
        console.log("调用了")
        getMsg();

    }, 60000);*/

    function openNewPage(title, url, receiverId, i) {
        $("#msgModel").find(".xiaoxiLine[attr-id=" + receiverId + "]").remove();
        console.log(title)
        if (title.indexOf("每周三") > -1) {
            top.closeTabByPageId("ThursdayTrackList")
            setTimeout(function () {
                //某种bug，需要延迟执行
                top.addTabs({
                    id: 'ThursdayTrackList',
                    title: '每周三商机跟踪',
                    close: true,
                    url: url
                });
            }, 100);

        } else if (title.indexOf("集团销售目标配置") > -1) {
            top.closeTabByPageId("groupSaleTarget")
            setTimeout(function () {
                //某种bug，需要延迟执行
                top.addTabs({
                    id: 'groupSaleTarget',
                    title: '销售目标配置',
                    close: true,
                    url: url
                });
            }, 100);
        } else if (title.indexOf("公司销售目标配置") > -1) {
            top.closeTabByPageId("companySaleTarget")
            setTimeout(function () {
                //某种bug，需要延迟执行
                top.addTabs({
                    id: 'companySaleTarget',
                    title: '销售目标配置',
                    close: true,
                    url: url
                });
            }, 100);
        } else if (title.indexOf("区域经理销售目标配置") > -1) {
            top.closeTabByPageId("daQuSaleTarget")
            setTimeout(function () {
                //某种bug，需要延迟执行
                top.addTabs({
                    id: 'daQuSaleTarget',
                    title: '销售目标配置',
                    close: true,
                    url: url
                });
            }, 100);
        } else if (title.indexOf("培训管理") > -1) {
            top.closeTabByPageId("ydst")
            var that = this;
            var title1 = title;
            setTimeout(function () {
                console.log(title1)
                //某种bug，需要延迟执行
                if (title1.indexOf("通过") > -1 || title1.indexOf("审核") > -1 || title1.indexOf("驳回") > -1) {
                    if (title1.indexOf("通过") > -1) {
                        top.addTabs({
                            id: 'xzpx',
                            title: '查看培训',
                            close: true,
                            url: url
                        });
                    } else if (title1.indexOf("审核") > -1) {
                        top.addTabs({
                            id: 'xzpx',
                            title: '审核培训',
                            close: true,
                            url: url
                        });
                    } else if (title1.indexOf("驳回") > -1) {
                        top.addTabs({
                            id: 'xzpx',
                            title: '编辑培训',
                            close: true,
                            url: url
                        });
                    }

                } else {
                    top.addTabs({
                        id: 'ydst',
                        title: '阅读材料',
                        close: true,
                        url: url
                    });
                }
            }, 100);
        } else if (title.indexOf("待付款申请") > -1) {
            top.closeTabByPageId("waitPayList")
            setTimeout(function () {
                //某种bug，需要延迟执行
                top.addTabs({
                    id: 'waitPayList',
                    title: '付款审核',
                    close: true,
                    url: url
                });
            }, 100);
        } else {
            top.$.dialog({
                content: 'url:' + url,
                title: title,
                width: 904,
                height: 535,
                max: true,
                min: true,
                lock: true
            });
        }

        $("#msgModel").find(".xiaoxiLine[attr-id=" + receiverId + "]").remove();
        console.log($("#msgModel").children().size());
        if ($("#msgModel").children().size() == 0) {
            $(".xiaoxi").hide();
        }
        console.log("id=" + receiverId);
        $.wyui.postMethod(urlConfig.system.message.setMessageReadFlag, {
            receiverId: receiverId,
            flag: '1'
        }, function (r) {
            console.log(r)
        });
    }
</script>
<!--socket-----------------------------------------------------------提醒-->
<script type="text/javascript" src="/dist/js/pages/sock/sockjs-0.3.min.js"></script>
<script type="text/javascript" src="/dist/js/pages/sock/reconnecting-websocket.min.js"></script>
<script type="text/javascript">
    var websocket;
    $(function () {
        // 首先判断是否 支持 WebSocket
        if ('WebSocket' in window) {
            if (server.ip.indexOf("https") > -1) {
                websocket = new ReconnectingWebSocket("wss://" + server.ip.replace("https:\/\/", '') + "/websocket");
            } else {
                websocket = new ReconnectingWebSocket("ws://" + server.ip.replace("http:\/\/", '') + "/websocket");
            }
        } else if ('MozWebSocket' in window) {
            if (server.ip.indexOf("https") > -1) {
                websocket = new MozWebSocket("wss://+ server.ip.replace(\"https:\\/\\/\",'') +/websocket");
            } else {
                websocket = new MozWebSocket("ws://+ server.ip.replace(\"http:\\/\\/\",'') +/websocket");
            }

        } else {
            if (server.ip.indexOf("https") > -1) {
                websocket = new SockJS("https://+ server.ip.replace(\"https:\\/\\/\",'') +/sockjs/websocket");
            } else {
                websocket = new SockJS("http://+ server.ip.replace(\"http:\\/\\/\",'') +/sockjs/websocket");
            }
        }
        // 打开时
        websocket.onopen = function (evnt) {
            /*var msg = {
                userId: getCurrentUser().id
            };
            // 发送消息
            websocket.send(JSON.stringify(msg));*/
            console.log((new Date()).Format("yyyy-MM-dd hh:mm:ss")+ " websocket连接成功！")
        };


        // 处理消息时
        websocket.onmessage = function (evnt) {
            console.log("  evnt.data   " + evnt.data);
            var josn = JSON.parse(evnt.data);
            var josnObject = josn.data.sendData;
            $(".xiaoxi").show();
            if (josnObject.length > 0 && oldMsgCt != josnObject[0].createTime) {
                /*红点，显示，消除*/
                if(josnObject[0].receiverUserId == getCurrentUser().id ){
                    if(josnObject[0].messageType == 5){
                        /*消红点*/
                        getRedHot();
                        return;
                    }
                    if(josnObject[0].messageType == 1){
                        getRedHot();
                    }
                }
                if(josnObject[0].messageType == 6){
                    updateDialog();
                }
                if ($("#msgModel").children().size() == 5) {
                    $("#msgModel").children()[4].remove();
                }
                if ($("#msgAddModel").children().size() == 5) {
                    $("#msgAddModel").children()[4].remove();
                }
                oldMsgCt = josnObject[0].createTime;
                var p = new Array();
                //console.log($("#msgModel").children())
                if ($("#msgModel").children().size() > 0) {
                    for (var i = 0; i < josnObject.length; i++) {
                        if (josnObject[i].receiverUserId == getCurrentUser().id) {
                            var data = josnObject[i];
                            p.push("<div class='xiaoxiLine' attr-id=" + data.receiverId + "><span onclick=openNewPage('" + excludeSpecial(data.openTitle) + "','" + data.openUrl.replace("/page/", "") + "','" + data.receiverId + "','" + i + "') style='cursor: pointer;'>" + initS(data.openTitle) + "</span></div>");
                        }
                    }
                    $("#msgModel").prepend(p.join(""))

                } else {
                    if ($("#msgModel").size()) {
                        for (var i = 0; i < josnObject.length; i++) {
                            if (josnObject[i].receiverUserId == getCurrentUser().id) {
                                var data = josnObject[i];
                                p.push("<div class='xiaoxiLine' attr-id=" + data.receiverId + "><span onclick=openNewPage('" + excludeSpecial(data.openTitle) + "','" + data.openUrl.replace("/page/", "") + "','" + data.receiverId + "','" + i + "') style='cursor: pointer;'>" + initS(data.openTitle) + "</span></div>");
                            }
                        }
                        if ($("#msgModel").children().size() == 0) {
                            $(".xiaoxi").hide();
                        }
                        $("#msgModel").prepend(p.join(""))
                    } else {
                        p.push("<div id='msgModel'>")
                        var num = 0;
                        for (var i = 0; i < josnObject.length; i++) {
                            if (josnObject[i].receiverUserId == getCurrentUser().id) {
                                var data = josnObject[i];
                                num++;
                                p.push("<div class='xiaoxiLine' attr-id=" + data.receiverId + "><span onclick=openNewPage('" + excludeSpecial(data.openTitle) + "','" + data.openUrl.replace("/page/", "") + "','" + data.receiverId + "','" + i + "') style='cursor: pointer;'>" + initS(data.openTitle) + "</span></div>");
                            }
                        }
                        p.push("</div>")
                        if (num != 0) {
                            $.dialog.notice({
                                title: '| 最新消息',
                                width: '310px', /*必须指定一个像素宽度值或者百分比，否则浏览器窗口改变可能导致lhgDialog收缩*/
                                height: "102px",
                                content: p.join(""),
                                time: 300,
                                close: true,
                                min: false,
                                max: false
                            });
                            //console.log($('#chatAudio'))
                            //$('#chatAudio')[0].play(); //播放声音
                        }
                    }
                }
            }
        }
        //发生错误时
        websocket.onerror = function (evnt) {
            console.log("  websocket.onerror  ");
        };
    })
</script>
<script>
    //    if(getCurrentUser().tel=="13934588177"){
    //        console.log("有手机编辑权限")
    //    }else{
    //        if(/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) {
    //            window.location.href = "/page/error.html";
    //        } else {
    //
    //        }
    //    }
    // $.wyui.postMethod("/updateInfo/save.json", {
    //     userId:getCurrentUser().id
    // },function (r) {})
</script>
</body>
</html>